home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / mac / DirectX SDK / DXSDK / samples / Multimedia / Direct3D / DXTex / dxtexview.h < prev    next >
C/C++ Source or Header  |  2001-10-08  |  5KB  |  128 lines

  1. // dxtexView.h : interface of the CDxtexView class
  2. //
  3. /////////////////////////////////////////////////////////////////////////////
  4.  
  5. #if !defined(AFX_DXTXVIEW_H__712C53D1_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
  6. #define AFX_DXTXVIEW_H__712C53D1_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_
  7.  
  8. #if _MSC_VER > 1000
  9. #pragma once
  10. #endif // _MSC_VER > 1000
  11.  
  12.  
  13. class CDxtexView : public CScrollView
  14. {
  15. protected: // create from serialization only
  16.     CDxtexView();
  17.     DECLARE_DYNCREATE(CDxtexView)
  18.     CDxtexDoc* GetDocument();
  19.  
  20. // Operations
  21. public:
  22.  
  23. // Overrides
  24.     // ClassWizard generated virtual function overrides
  25.     //{{AFX_VIRTUAL(CDxtexView)
  26.     public:
  27.     virtual void OnDraw(CDC* pDC);  // overridden to draw this view
  28.     virtual void OnInitialUpdate();
  29.     protected:
  30.     virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
  31.     //}}AFX_VIRTUAL
  32.  
  33. // Implementation
  34. public:
  35.     virtual ~CDxtexView();
  36. #ifdef _DEBUG
  37.     virtual void AssertValid() const;
  38.     virtual void Dump(CDumpContext& dc) const;
  39. #endif
  40.     BOOL TitleModsChanged(VOID) { return m_bTitleModsChanged; }
  41.     VOID ClearTitleModsChanged(VOID) { m_bTitleModsChanged = FALSE; }
  42.     CString GetStrTitleMods(VOID);
  43.     VOID GetImageInfo(CString& strInfo);
  44.  
  45. // Generated message map functions
  46. protected:
  47.     //{{AFX_MSG(CDxtexView)
  48.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  49.     afx_msg void OnFileOpenSubsurface();
  50.     afx_msg void OnFileOpenAlphaSubsurface();
  51.     afx_msg void OnFileOpenFace();
  52.     afx_msg void OnFileOpenAlphaFace();
  53.     afx_msg void OnViewOriginal();
  54.     afx_msg void OnViewCompressed();
  55.     afx_msg void OnViewAlphaChannel();
  56.     afx_msg void OnViewLargerMipLevel();
  57.     afx_msg void OnViewSmallerMipLevel();
  58.     afx_msg void OnViewZoomIn();
  59.     afx_msg void OnViewZoomOut();
  60.     afx_msg void OnViewChangeBackgroundColor();
  61.     afx_msg void OnViewNegX();
  62.     afx_msg void OnViewPosX();
  63.     afx_msg void OnViewNegY();
  64.     afx_msg void OnViewPosY();
  65.     afx_msg void OnViewNegZ();
  66.     afx_msg void OnViewPosZ();
  67.     afx_msg void OnViewHigherVolumeSlice();
  68.     afx_msg void OnViewLowerVolumeSlice();
  69.     afx_msg void OnUpdateFileOpenSubsurface(CCmdUI* pCmdUI);
  70.     afx_msg void OnUpdateFileOpenAlphaSubsurface(CCmdUI* pCmdUI);
  71.     afx_msg void OnUpdateFileOpenFace(CCmdUI* pCmdUI);
  72.     afx_msg void OnUpdateFileOpenAlphaFace(CCmdUI* pCmdUI);
  73.     afx_msg void OnUpdateViewOriginal(CCmdUI* pCmdUI);
  74.     afx_msg void OnUpdateViewCompressed(CCmdUI* pCmdUI);
  75.     afx_msg void OnUpdateViewAlphaChannel(CCmdUI* pCmdUI);
  76.     afx_msg void OnUpdateViewLargerMipLevel(CCmdUI* pCmdUI);
  77.     afx_msg void OnUpdateViewSmallerMipLevel(CCmdUI* pCmdUI);
  78.     afx_msg void OnUpdateViewZoomIn(CCmdUI* pCmdUI);
  79.     afx_msg void OnUpdateViewZoomOut(CCmdUI* pCmdUI);
  80.     afx_msg void OnUpdateViewNegX(CCmdUI* pCmdUI);
  81.     afx_msg void OnUpdateViewPosX(CCmdUI* pCmdUI);
  82.     afx_msg void OnUpdateViewNegY(CCmdUI* pCmdUI);
  83.     afx_msg void OnUpdateViewPosY(CCmdUI* pCmdUI);
  84.     afx_msg void OnUpdateViewNegZ(CCmdUI* pCmdUI);
  85.     afx_msg void OnUpdateViewPosZ(CCmdUI* pCmdUI);
  86.     afx_msg void OnUpdateViewHigherVolumeSlice(CCmdUI* pCmdUI);
  87.     afx_msg void OnUpdateViewLowerVolumeSlice(CCmdUI* pCmdUI);
  88.     //}}AFX_MSG
  89.     DECLARE_MESSAGE_MAP()
  90.  
  91. private:
  92.     HRESULT UpdateDevice(VOID);
  93.     HRESULT RenderScene(VOID);
  94.     CDxtexApp* PDxtexApp(VOID) { return (CDxtexApp*)AfxGetApp(); }
  95.     HRESULT BuildViewSurface(BOOL bOrig, D3DCUBEMAP_FACES FaceType, LONG lwSlice, LONG lwMip, BOOL bViewAlpha);
  96.     HRESULT LoadSurfaceFromVolumeSlice(LPDIRECT3DVOLUME8 pVolume, UINT iSlice, LPDIRECT3DSURFACE8 psurf);
  97.  
  98.     DWORD NumBytesInSurfaces(D3DCUBEMAP_FACES FaceType, LPDIRECT3DBASETEXTURE8 ptex);
  99.     HRESULT CreateVertexBuffer(VOID);
  100.     CString FormatName(D3DFORMAT fmt);
  101.  
  102.     LPDIRECT3DVERTEXBUFFER8 m_pVB;
  103.     LPDIRECT3DTEXTURE8 m_ptexCur; // Currently-viewed texture surface
  104.     LPDIRECT3DSWAPCHAIN8 m_pSwapChain;
  105.     CRect m_rcSrc; // Size of m_pddsCur and m_pddsBack
  106.     CRect m_rcDest; // m_rcDest scaled by m_fZoom
  107.     FLOAT m_fZoom; // Zoom factor
  108.     BOOL m_bViewOrig; // View "original" vs. "new" surface
  109.     BOOL m_bViewAlpha; // View alpha channel alone vs. normal image
  110.     BOOL m_bTitleModsChanged; // Whether title bar text modifiers need to be updated
  111.     LONG m_lwMipCur; // Currently-viewed mip.  0 = top, 1 = next one down, etc.
  112.     D3DCUBEMAP_FACES m_CubeFaceCur; // D3DCUBEMAP_FACE_FORCE_DWORD = no cube map, or D3DCUBEMAP_FACE_POSITIVE_X, etc.
  113.     LONG m_lwSliceCur; // For volume maps
  114.     DWORD m_dwClearColor; // Background color that will show through where alpha is non-opaque
  115. };
  116.  
  117. #ifndef _DEBUG  // debug version in dxtexView.cpp
  118. inline CDxtexDoc* CDxtexView::GetDocument()
  119.    { return (CDxtexDoc*)m_pDocument; }
  120. #endif
  121.  
  122. /////////////////////////////////////////////////////////////////////////////
  123.  
  124. //{{AFX_INSERT_LOCATION}}
  125. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  126.  
  127. #endif // !defined(AFX_DXTXVIEW_H__712C53D1_D63B_11D1_A8B5_00C04FC2DC22__INCLUDED_)
  128.